<template>
  <el-form :model="model" ref="lotFeeForm" :inline="true"  label-width="72px" :label-position="'left'" >
    <el-row class="search-title">条件搜索</el-row>
    <el-row >
      <el-form-item prop="orgno">
        <el-col style="width: 75px">
          <span style="font-size: 12px; font-weight: bold; color: #7A7A7A;">选择单位</span>
        </el-col>
        <el-checkbox-group  v-model="model.orgno" size="mini">
          <el-checkbox  v-for="item in dws" :label="item.orgno" :key="item.orgno">{{item.orgname}}</el-checkbox>
        </el-checkbox-group>
      </el-form-item>
    </el-row>
    <el-row>
    <el-form-item prop="parkName" label="选择停车场">
      <el-input readonly v-model="model.parkName" placeholder="请选择停车场" @click.native="handleSelectParkLotFee" clearable></el-input>
    </el-form-item>

    <el-form-item prop="rangeTime" label="日期范围">
      <el-date-picker
        v-model="model.rangeTime" type="daterange" align="right" unlink-panels range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"
        :picker-options="pickerOptions" clearable format="yyyy 年MM 月dd 日" value-format="yyyy-MM-dd">
      </el-date-picker>
    </el-form-item>
    <el-form-item> <el-button class="btn-search" type="primary"  @click="handleQueryLotFee">搜索</el-button></el-form-item>
    </el-row>
    <!--<collapse-vertical>-->
    <!--<div  v-show="isDisplay">-->
      <!--<el-button class="btn-mini-form"  @click="handleQueryLotFee"-->
                 <!--size="mini" >提交-->
      <!--</el-button>-->
      <!--<el-button class="btn-mini-form"  @click="handleResetLotFee"-->
                 <!--size="mini" >重置-->
      <!--</el-button>-->
    <!--</div>-->
    <!--</collapse-vertical>-->
    <!--<el-row style="text-align: center"><el-button style="border: none;background-color: transparent" size="small" @click="isShow" :icon="isDisplay?'el-icon-arrow-up':'el-icon-arrow-down'"></el-button></el-row>-->
    <parking-dialog :parkingVisible.sync="selectParkVisible" @parkName="parkNameLotFee"></parking-dialog>
  </el-form>
</template>

<script>
  /* eslint-disable */
  import ElInput from "element-ui/packages/input/src/input";
  import ParkingDialog from "../../operatingManagement/parkingflowChild/parkingDialog";
  import {getDwList} from "../../../api/public/searchUnit";
  import CollapseVertical from '../../../utils/collapseVertical'

  export default {
    components: {
      ParkingDialog,
      ElInput,CollapseVertical},
    name: "lot-fee-form",
    created(){
      this.getDwList()
    },
    data(){
      return{
        pickerOptions: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
              picker.$emit('pick', [start, end])
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30)
              picker.$emit('pick', [start, end])
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date()
              const start = new Date()
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90)
              picker.$emit('pick', [start, end])
            }
          }]
        },
        selectParkVisible: false,
        isDisplay: false,
        model: {
          rangeTime: [new Date(), new Date()],
          orgno: [],
          parkName: ''
        },

        dws:[],
        // rulesLotFee:{
        //   orgno:[{required: true, message: '请选择单位', trigger: 'change'}]
        // }
      }
    },
    methods:{
      handleQueryLotFee() {
        this.$refs['lotFeeForm'].validate((valid) => {
          if(valid){
            this.$emit('handleQueryLotFee', this.model)
          }else {
            this.$message({
              type: 'warning',
              message: '',
              duration: 2000
            })
          }
        })

      },
      handleResetLotFee() {
        this.$refs['lotFeeForm'].resetFields()
      },
      handleSelectParkLotFee(){
        this.selectParkVisible=true
      },
      parkNameLotFee(val){
        this.model.parkName=val.parkname
      },
      getDwList(){
        getDwList().then(res=>{
          this.dws=res
        })
      },
      isShow(){
        this.isDisplay =!this.isDisplay
      }
    }
  }
</script>

<style scoped>

</style>
